﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CubicFWNet.Data.Models.Mapping
{
    public class FinanceInvoiceMap : EntityTypeConfiguration<FinanceInvoice>
    {
        public FinanceInvoiceMap() 
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Number)
                .HasMaxLength(128);

            this.Property(t => t.CreatorName)
                .HasMaxLength(64);

            this.Property(t => t.Memo)
                .HasMaxLength(256);

            this.Property(t => t.FinanceInvoiceMemo)
                .HasMaxLength(256);

            // Table & Column Mappings
            this.ToTable("FinanceInvoice");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.OrderId).HasColumnName("OrderId");
            this.Property(t => t.ProductData).HasColumnName("ProductData");
            this.Property(t => t.CreatorId).HasColumnName("CreatorId");
            this.Property(t => t.CreatorName).HasColumnName("CreatorName");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.ApplyTime).HasColumnName("ApplyTime");
            this.Property(t => t.ApplyId).HasColumnName("ApplyId");
            this.Property(t => t.Memo).HasColumnName("Memo");
            this.Property(t => t.FinanceInvoiceMemo).HasColumnName("FinanceInvoiceMemo");
            this.Property(t => t.Type).HasColumnName("Type");
        }
    }
}
